[C#] LINQ Group By


In some scenarios, we would like to select each first one row
of the group which we group by personId.

The following code block is a simple example.

var memberList =
    memberSourceData.GroupBy(item => item.personId)
        .Select(chunck => chunck
            .OrderByDescending(c => c.Id)
            .First())
        .ToList();
#C#






你可能感興趣的文章

[BE101] 初探 PHP

[BE101] 初探 PHP

打包程式碼必備 bundler : Webpack

打包程式碼必備 bundler : Webpack

滲透測試重新打底(3.1)--論Web入侵之Burp Suite基本使用

滲透測試重新打底(3.1)--論Web入侵之Burp Suite基本使用






留言討論